#!/usr/bin/env python
import os.path
import sys
import logging

import canvaside

if __name__=='__main__':
    logging.basicConfig(level=logging.DEBUG if "-v" in sys.argv else logging.WARN,
                        format='%(asctime)s %(levelname)s %(name)s %(message)s')

    for arg in sys.argv[1:]:
        if arg[0] == '-':
            continue

        dom = canvaside.parseFile(arg) if os.path.exists(arg) else canvaside.parseUrl(arg)

        for canvas in canvaside.render(dom):
            canvas.show()